$(document).ready(function() {
	
	//定位物流跟踪位置
	var $optionA = $(".myCollect-table .shanpin-list td.td-price .Sales span");
	var LwlTime = null;
	var $Notice = $("#Notice-tips");
		$optionA.hover(function() {
			clearTimeout(LwlTime);
			$Notice.show().css({
				top:$(this).offset().top+23+"px",
				left:$(this).offset().left-80+"px"
			});
		}, function() {
			LwlTime = setTimeout(function(){
				$Notice.hide();
			},1000);	
		});

		$Notice.hover(function(event) {
			clearTimeout(LwlTime);
			$(this).show();
		},function(){
			$(this).hide();
		});
		  
});

$(document).ready(function() {
	
	//定位物流跟踪位置
	var $optionB = $(".wl-box a");
	var wlTime = null;
	var $wlListShow = $("#wl-list-show");
		$optionB.hover(function() {
			clearTimeout(wlTime);
			$wlListShow.show().css({
				top:$(this).offset().top+28+"px",
				left:$(this).offset().left+22+"px"
			});
		}, function() {
			wlTime = setTimeout(function(){
				$wlListShow.hide();
			},1000);	
		});

		$wlListShow.hover(function(event) {
			clearTimeout(wlTime);
			$(this).show();
		},function(){
			$(this).hide();
		});
		  
});

//radio单选与checkbox多选按钮的模拟
        (function ($) {
            $.fn.bindCheckboxRadioSimulate = function (options) {
                var settings = {
                    className: 'on',
                    onclick: null,
                    checkbox_checked_fn: function (obj) {
                        obj.parent().addClass(this.className);
                    },
                    checkbox_nochecked_fn: function (obj) {
                        obj.parent().removeClass(this.className);
                    },
                    radio_checked_fn: function (obj) {
                        obj.parent().addClass(this.className);
                    },
                    radio_nochecked_fn: function (obj) {
                        obj.parent().removeClass(this.className);
                    }
                };
                $.extend(true, settings, options);

                //input判断执行
                function inputJudge_fn(obj_this) {
                   
                    var $this = obj_this,
                        $type;
                    if ($this.attr('type') != undefined) {
                        $type = $this.attr('type');
                        if ($type == 'checkbox') {//if=多选按钮
                            if ($this.prop("checked")) {
                                settings.checkbox_checked_fn($this);
                            } else {
                                settings.checkbox_nochecked_fn($this);
                            }
                        } else if ($type == 'radio') {//if=单选按钮
                            var $thisName;
                            if ($this.attr('name') != undefined) {
                                $thisName = $this.attr('name');
                                if ($this.prop("checked")) {
                                    settings.radio_checked_fn($this);
                                    $("input[name='" + $thisName + "']").not($this).each(function () {
                                        settings.radio_nochecked_fn($(this));
                                    });
                                } else {
                                    settings.radio_nochecked_fn($this);
                                }
                            }
                        }
                    }
                }
                return this.each(function () {
                    inputJudge_fn($(this));
                }).click(function () {
                    inputJudge_fn($(this));
                    if (settings.onclick) {
                        settings.onclick(this, {
                            isChecked: $(this).prop("checked"),//返回是否选中
                            objThis: $(this)//返回自己
                        });
                    }
                });
            };
        })(jQuery);


        $(function () {
            //checkbox模拟--记住密码
            $('.checkbox-moni input').bindCheckboxRadioSimulate();
            //radio模拟--记住密码
            $('.radio-moni input').bindCheckboxRadioSimulate();
        })


//轮播
$(document).ready(function(){
    
    var intitNum = 0;
    var screenwidth = 1040;
    var $liSizes = 10;
    var $bigboxul = $('.bigbox ul')
    var $prevBtn = $('#js_Mpage_pre');
    var $nextBtn = $('#js_Mpage_next');
    var $SprevBtn = $('#js_Spre');
    var $SnextBtn = $('#js_Snext');
    var $scrollNum = $('.imagesbox ul li')
    var $imagesbox = $('.imagesbox ul')
    var $simg = $('.imagesbox ul li')
    
    //上一个
    $prevBtn.click(function(){
        intitNum--;
        changeImg(intitNum);
        if(intitNum == 7){
            changeSImg(0);
        }
    });
    //下一个
    $nextBtn.click(function(){
        intitNum++;
        //alert('下一个')
        changeImg(intitNum);
        if(intitNum == 8){
            changeSImg(1);
        }
        
    });
    //上一列
    $SprevBtn.click(function(){
        //intitNum--;
        changeSImg(0);
    });
    //下一列
    $SnextBtn.click(function(){
        //intitNum++;/
        changeSImg(1);
        
    });
    
    //点击小图
    $simg.click(function(){
        //intitNum++;/
        intitNum = $(this).index()
        changeImg(intitNum);
        
    });
    //鼠标经过小图
    $simg.hover(function(){
       $(this).children().css({ 'width':'137px', 'height':'85px', 'position':'absolute', 'z-index':'5', 'left':'-15px', 'top':'-9px'})
       $(this).css({'z-index':'5'})
    },function(){
       $(this).children().css({ 'width':'107px', 'height':'66px', 'left':'0px', 'top':'0px'})
       $(this).css({'z-index':'0'})
    })

    //小图轮播切换
    function changeSImg(obj){
        //$scrollNum.eq(obj).addClass('act').siblings().removeClass('act');
        $imagesbox.stop().animate({left:-obj*896+"px"},600,function(){
            if(obj == 1){
               $SnextBtn.hide()
            }else{
               $SnextBtn.show()
            }
            
            if(obj == 0){
               $SprevBtn.hide()
            }else{
               $SprevBtn.show()
            }
            
        });
    }
    //轮播切换
    function changeImg(obj){
        $scrollNum.eq(obj).addClass('act').siblings().removeClass('act');
        $bigboxul.stop().animate({left:-obj*screenwidth+"px"},600,function(){
            if(obj == 10){
               $nextBtn.hide()
            }else{
               $nextBtn.show()
            }
            
            if(obj == 0){
               $prevBtn.hide()
            }else{
               $prevBtn.show()
            }
            
        });
    }
    
})
